package com.tju.resource.oauth.controller.tb;

import cn.hutool.json.JSONObject;
import com.tju.resource.annotation.Log;
import com.tju.resource.model.TbShapRev;
import com.tju.resource.business.tb_shap_rev.TbShapRevService;
import com.tju.resource.result.Result;
import com.tju.resource.tool.enum_utils.FunctionType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class TbShapRevController {

    private final String prefix = "shaprev";

    @Autowired
    TbShapRevService service;

    @PostMapping(prefix + "/byshap")
    @PreAuthorize("hasAuthority('sys:tool:sharper:list')")
    @Log(type = FunctionType.List)
    public Result<List<TbShapRev>> byShap(@RequestBody JSONObject body) {
        return service.byShap(body);
    }

    @PostMapping(prefix + "/handle")
    @PreAuthorize("hasAuthority('sys:tool:sharper:edit')")
    @Log(type = FunctionType.Modify)
    public Result<Object> handle(@RequestBody JSONObject body) {
        return service.handle(body);
    }

}
